// 工具方法集合
import * as utils from "./utils.js" // 工具
import * as check from "./check.js" // check
import * as color from "./color.js" // 颜色
import * as date from "./date.js" // 时间
import * as hook from "./hook.js" // 工具
import * as download from "./download.js" // 分享
import * as format from "./format.js" // 格式化
import * as location from "./location.js" // 定位
import * as login from "./login.js" // 登录
import * as map from "./map.js" // 地图
import * as pay from "./pay.js" // 支付
import * as platform from "./platform.js" // 平台类型
import * as update from "./update.js" // 更新
import * as vuex from "./vuex.js" // vuex

const all = {
  check,
  pay,
  ...hook,
  ...date,
  ...utils,
  ...map,
  ...vuex,
  ...color,
  ...login,
  ...update,
  ...download,
  ...format,
  ...location,
  ...platform
}

export default (Vue) => {
  Object.keys(all).forEach((name) => {
    if (uni.canIUse(`$${name}`)) {
      console.warn(`utils/${name}已经被uni-app占用，将不会被挂载到Vue.prototype上`)
    } else {
      uni[`$${name}`] = all[name]
      Vue.prototype[`$${name}`] = all[name]
    }
  })
}
